# @Time : 2023/1/5
# @Author : SDAJAVA

import urllib.request
import urllib.error

url = 'https://blog.csdn.net/OneFlow_Official/article/details/128489898'

headers = {
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
    }
try:
    request = urllib.request.Request(url=url,headers=headers)

    response = urllib.request.urlopen(request)

    content = response.read().decode('utf-8')

    print(content)
except urllib.error.HTTPError:
    print('页面丢失！')
except urllib.error.URLError:
    print('URL路径错误')